home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / MEMORY.SWG / 0046_DPMI Routines.pas < prev    next >
Pascal/Delphi Source File  |  1994-01-27  |  4KB  |  81 lines

  1. UNIT DPMI;              { DPMI routines, Last Updated Aug 7/93          }
  2.                         { Copyright (C) 1993, Greg Estabrooks           }
  3. INTERFACE
  4. {***********************************************************************}
  5. VAR
  6.    DPMIControl :POINTER;
  7.    ParNeeded   :WORD;
  8.  
  9. FUNCTION DPMI_Installed :BOOLEAN;
  10.                         { Routine to Determine whether a DPMI API is    }
  11.                         { installed. If it is installed it loads the    }
  12.                         { address of the API into DPMIControl for later }
  13.                         { program use. Loads ParaNeeded with paragraphs }
  14.                         { needed for Host data area.                    }
  15.  
  16. FUNCTION DPMIControlAdr :POINTER;
  17.                         { This routine returns a pointer to the DPMI    }
  18.                         { control.                                      }
  19.  
  20. FUNCTION DPMIVer :WORD;
  21.                         { This routine returns the Version of the DPMI  }
  22.  
  23. FUNCTION Processor :BYTE;
  24.                         { Routine to return processor type as returned  }
  25.                         { by the DPMI API.                              }
  26.  
  27. {***********************************************************************}
  28. IMPLEMENTATION
  29.  
  30. FUNCTION DPMI_Installed :BOOLEAN; ASSEMBLER;
  31.                         { Routine to Determine whether a DPMI API is    }
  32.                         { installed. If it is installed it loads the    }
  33.                         { address of the API into DPMIControl for later }
  34.                         { program use. Loads ParaNeeded with paragraphs }
  35.                         { needed for Host data area.                    }
  36. ASM
  37.   Mov AX,$1687                  { Function to check for DPMI.           }
  38.   Int $2F                       { Call Int 2Fh.                         }
  39.   Cmp AX,0                      { Compare Result to 0.                  }
  40.   Je @Installed                 { If its equal jump to Installed.       }
  41.   Mov AL,0                      { Else return FALSE.                    }
  42.   Jmp @Exit                     { Jump to end of routine.               }
  43.  
  44. @Installed:
  45.   Mov DPMIControl.WORD,DI       { Load pointer ES:DI into DPMIControl.  }
  46.   Mov DPMIControl+2.WORD,ES
  47.   Mov ParNeeded,SI              { Load Paragraphs needed into ParNeeded.}
  48.   Mov AL,1                      { Set true flag.                        }
  49.  
  50. @Exit:
  51. END;{DPMI_Installed}
  52.  
  53. FUNCTION DPMIControlAdr :POINTER; ASSEMBLER;
  54.                         { This routine returns a pointer to the DPMI    }
  55.                         { control.                                      }
  56. ASM
  57.   Mov AX,$1687                  { Function to return point to API.      }
  58.   Int $2F                       { Call Int 2Fh.                         }
  59.   Mov DX,ES                     { Pointer info is returned in ES:DI.    }
  60.   Mov AX,DI
  61. END;{DPMIControlAdr}
  62.  
  63. FUNCTION DPMIVer :WORD; ASSEMBLER;
  64.                         { This routine returns the Version of the DPMI  }
  65. ASM
  66.   Mov AX,$1687                  { Function to get version of DPMI API.  }
  67.   Int $2F                       { Call int 2Fh.                         }
  68.   Mov AX,DX                     { Version is returned in DX.            }
  69. END;{DPMIVer}
  70.  
  71. FUNCTION Processor :BYTE; ASSEMBLER;
  72.                         { Routine to return processor type as returned  }
  73.                         { by the DPMI API.                              }
  74. ASM
  75.   Mov AX,$1687                  { Function to get info from DPMI.       }
  76.   Int $2F                       { Call Int 2Fh.                         }
  77.   Mov AL,CL                     { Processor type returned in CL.        }
  78. END;{Processor}
  79.  
  80. BEGIN
  81. END.